<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
    a {
        width: 100px;
        height: 40px;
        color: #000;
        font-size: 20px;
    }
    </style>
</head>

<body>
    <input type="text" id="uploadInput">
    <a href="javascript:;" id="uploadBtn">上传</a>
    <script type="text/javascript">
    var uploadBtn = document.getElementById("uploadBtn");
    var uploadInput = document.getElementById("uploadInput");
    uploadBtn.addEventListener("click", function() {
        var val = uploadInput.value;
        if (!!val) {
            var xhr=new XMLHttpRequest();
            var data=JSON.stringify({val:val});
            xhr.open("post","http://localhost:9000",true);
            xhr.setRequestHeader("Content-Type","application/json");
            xhr.setRequestHeader("Authorition","123213");
            xhr.onload=function(data){
              console.log(data);
              console.log(xhr.getResponseHeader("Content-Type"));
              console.log(xhr.responseText);
            }
            xhr.send("dsfsfdsfdsf");
        }
    }, false)
    </script>
</body>

</html>
